package cn.edu.spring;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test {

    @Test
    public void test01(){
        ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");
        Context context= (Context) ac.getBean("context");
        System.out.println(context);
        ((ClassPathXmlApplicationContext)ac).close();

    }

    @Test
    public void test02() {


        try {
            ApplicationContext ac=new ClassPathXmlApplicationContext("beanss.xml");
            Context context= (Context) ac.getBean("context");
            System.out.println(context);
            ((ClassPathXmlApplicationContext)ac).close();
        }catch (Exception e){
            System.out.println(e);

        }



    }
}
